package mbg.plugin;


import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.PluginAdapter;

import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static org.mybatis.generator.internal.util.StringUtility.stringHasValue;
import static org.mybatis.generator.internal.util.messages.Messages.getString;

/**
 * 此处是将User改名为UserDo当然 想改成什么都行~
 */
public class RenameModelClassPlugin extends PluginAdapter {
    private String suffix;

    public RenameModelClassPlugin() {
	}

	public boolean validate(List<String> warnings) {
        suffix = properties.getProperty("suffix");
        return true;
    }

    @Override
    public void initialized(IntrospectedTable introspectedTable) {
        String baseRecordType = introspectedTable.getBaseRecordType();
        introspectedTable.setBaseRecordType(baseRecordType + suffix);
    }
}

